<?php
/**
 *
 *
 */
class Yz_Property_Date
    extends Yz_Property_Scalar
{

    /** Test if a value is a valid true/false
     *  @param mixed value
     *  @return bool
     *  @throw InvalidArgument
     */
    public function testValue($value)
    {
        $value = parent::testValue($value);
        if (null === $value)
            return null;
        return new Yz_Date($value);
    }


    /** Select a default value
     *  @return default value
     */
    public function defaultValue()
    {
        $v = null;
        $d = $this->fetchConfig('default');
        if ($d)
            if ('now' === strtolower($d))
                $d = null;
            $v = new Yz_Date($d);
        return $v;
    }

}
